package com.test.model;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.util.Date;
import java.util.Dictionary;
import java.util.Set;


/**
 * Created by jiche_000 on 2016-03-03.
 */
@Entity
@Table(name = "rcc_e_stationMeter")
public class StationMeter extends EquModel {
	private int uniqueId;
	private String branchPosition;
	private String serialNo;
	private Integer caliber;
	private Model model;
	private Collector collector;
	private Integer port;
	private Integer index;
	private Date installDate;
	private Date createDate;
	private StationBranch stationBranch;
	private String memo;
	private String detailPosition;
	private NetEqu netEqu;
	private String equState;
//	private Dictionary equProblem;
	private Set<StationMeterCurrentData> stationMeterCurrentdata;
//	private Set<StationMeterCurrentAlarm> stationMeterCurrentAlarm;
//	private Set<StationMeterCurrentFault> stationMeterCurrentFault;
//	private Set<StationMeterHistoricalFault> stationMeterHistoricalFault;
//	private Set<StationMeterHistoricalAlarm> stationMeterHistoricalAlarm;

	//
	@Id
	@GeneratedValue
	@Column(name = "uniqueId", unique = true, nullable = false)
	public int getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(int uniqueId) {
		this.uniqueId = uniqueId;
	}

	@Column(name = "branchPosition")
	public String getBranchPosition() {
		return branchPosition;
	}

	public void setBranchPosition(String branchPosition) {
		this.branchPosition = branchPosition;
	}

	@Column(name = "serialNo")
	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	@Column(name = "caliber")
	public Integer getCaliber() {
		return caliber;
	}

	public void setCaliber(Integer caliber) {
		this.caliber = caliber;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "modelId")
	public Model getModel() {
		return model;
	}

	public void setModel(Model model) {
		this.model = model;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "collectorId")
	public Collector getCollector() {
		return collector;
	}

	public void setCollector(Collector collector) {
		this.collector = collector;
	}

	@Column(name = "`port`")
	public Integer getPort() {
		return port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	@Column(name = "`index`")
	public Integer getIndex() {
		return index;
	}

	public void setIndex(Integer index) {
		this.index = index;
	}

	@Column(name = "installDate")
	public Date getInstallDate() {
		return installDate;
	}

	public void setInstallDate(Date installDate) {
		this.installDate = installDate;
	}

	@Column(name = "createDate")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "stationBranchId")
	public StationBranch getStationBranch() {
		return stationBranch;
	}

	public void setStationBranch(StationBranch stationBranch) {
		this.stationBranch = stationBranch;
	}

	@Column(name = "memo")
	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@Column(name = "detailPosition")
	public String getDetailPosition() {
		return detailPosition;
	}

	public void setDetailPosition(String detailPosition) {
		this.detailPosition = detailPosition;
	}

//	@OneToMany(mappedBy = "stationMeter")
//	public Set<StationMeterCurrentAlarm> getStationMeterCurrentAlarm() {
//		return stationMeterCurrentAlarm;
//	}
//
//	public void setStationMeterCurrentAlarm(
//			Set<StationMeterCurrentAlarm> stationMeterCurrentAlarm) {
//		this.stationMeterCurrentAlarm = stationMeterCurrentAlarm;
//	}
//
//	@OneToMany(mappedBy = "stationMeter")
//	public Set<StationMeterCurrentFault> getStationMeterCurrentFault() {
//		return stationMeterCurrentFault;
//	}
//
//	public void setStationMeterCurrentFault(
//			Set<StationMeterCurrentFault> stationMeterCurrentFault) {
//		this.stationMeterCurrentFault = stationMeterCurrentFault;
//	}
//
//	@OneToMany(mappedBy = "stationMeter")
//	public Set<StationMeterHistoricalFault> getStationMeterHistoricalFault() {
//		return stationMeterHistoricalFault;
//	}
//
//	public void setStationMeterHistoricalFault(
//			Set<StationMeterHistoricalFault> stationMeterHistoricalFault) {
//		this.stationMeterHistoricalFault = stationMeterHistoricalFault;
//	}
//
//	@OneToMany(mappedBy = "stationMeter")
//	public Set<StationMeterHistoricalAlarm> getStationMeterHistoricalAlarm() {
//		return stationMeterHistoricalAlarm;
//	}
//
//	public void setStationMeterHistoricalAlarm(
//			Set<StationMeterHistoricalAlarm> stationMeterHistoricalAlarm) {
//		this.stationMeterHistoricalAlarm = stationMeterHistoricalAlarm;
//	}

	@OneToMany(mappedBy = "stationMeter")
	public Set<StationMeterCurrentData> getStationMeterCurrentdata() {
		return stationMeterCurrentdata;
	}

	public void setStationMeterCurrentdata(
			Set<StationMeterCurrentData> stationMeterCurrentdata) {
		this.stationMeterCurrentdata = stationMeterCurrentdata;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "netEquId")
	public NetEqu getNetEqu() {
		return netEqu;
	}

	public void setNetEqu(NetEqu netEqu) {
		this.netEqu = netEqu;
	}
	@Column(name = "equState")
	public String getEquState() {
		return equState==null?"可用":equState;
	}

	public void setEquState(String equState) {
		this.equState = equState;
	}
//	@ManyToOne(fetch = FetchType.LAZY)
//	@JoinColumn(name = "equProblem")
//	@NotFound(action = NotFoundAction.IGNORE)
//	public Dictionary getEquProblem() {
//		return equProblem;
//	}
//
//	public void setEquProblem(Dictionary equProblem) {
//		this.equProblem = equProblem;
//	}
}
